using System;
using System.Data;
using System.Collections.Generic;
namespace eTMS.DAO
{
    /********************************BEGIN NewsDAOBase****************************************/
    ///<summary>
    /// <para>Author: Auto generated class by CSharp Code Generator v2.0</para>
    /// <para>Date:01/10/2010 33:09:48</para>
    /// <para>Class Name: NewsDAOBase</para>
    /// <para>Description: Class access to table News in database. Coder should'nt code here.</para>
    ///</summary>


    public abstract class NewsDAOBase : ADOBase.DAOBase<NewsEntity>
    {


        #region Select functions
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: CreateSelectOneCommand</para>
        /// <para>Input: New_ID</para>
        /// <para>Output: IDbCommand</para>
        ///</summary>
        protected IDbCommand CreateSelectOneCommand(int New_ID)
        {
            string strSQL = "SELECT  [New_ID],[Title],[MainContent],[Content],[NewIndex],[DatePost],[Status],[Display],[IsHomePage],[DateAproved],[DateExprired],[Category_ID],[User_ID],[Approved_ID],[SmallImageUrl],[LargeImageUrl] FROM [News]  WHERE [News].[New_ID]=@New_ID";
            IDbCommand cmd = this.CreateCommand(strSQL);
            cmd.CommandType = CommandType.Text;
            this.CreateCommandParameter(cmd, "@New_ID", New_ID);



            return cmd;
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: SelectOne</para>
        /// <para>Input: New_ID</para>
        /// <para>Output: NewsEntity</para>
        ///</summary>
        public NewsEntity SelectOne(int New_ID)
        {
            IDbCommand cmd = this.CreateSelectOneCommand(New_ID);
            return this.Select(cmd);
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: CreateSelectAllCommand</para>
        /// <para>Input: </para>
        /// <para>Output: IDbCommand</para>
        ///</summary>
        protected IDbCommand CreateSelectAllCommand()
        {
            string strSQL = "SELECT  [New_ID],[Title],[MainContent],[Content],[NewIndex],[DatePost],[Status],[Display],[IsHomePage],[DateAproved],[DateExprired],[Category_ID],[User_ID],[Approved_ID],[SmallImageUrl],[LargeImageUrl] FROM [News] ";
            IDbCommand cmd = this.CreateCommand(strSQL);
            cmd.CommandType = CommandType.Text;
            return cmd;
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: CreateSelectAllByKeyCommand</para>
        /// <para>Input: ColumnName,ColumnValue</para>
        /// <para>Output: IDbCommand</para>
        ///</summary>
        protected IDbCommand CreateSelectAllByKeyCommand(string ColumnName, object Value)
        {
            string strSQL = "SELECT  [New_ID],[Title],[MainContent],[Content],[NewIndex],[DatePost],[Status],[Display],[IsHomePage],[DateAproved],[DateExprired],[Category_ID],[User_ID],[Approved_ID],[SmallImageUrl],[LargeImageUrl] FROM [News]  WHERE [News].[" + ColumnName + "]=@ColumnName";
            IDbCommand cmd = this.CreateCommand(strSQL);
            cmd.CommandType = CommandType.Text;
            this.CreateCommandParameter(cmd, "@ColumnName", Value);



            return cmd;
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: SelectAll</para>
        /// <para>Input: </para>
        /// <para>Output: List of NewsEntity</para>
        ///</summary>
        public List<NewsEntity> SelectAll()
        {
            IDbCommand cmd = this.CreateSelectAllCommand();
            return this.SelectList(cmd);
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: SelectAllDS</para>
        /// <para>Input: </para>
        /// <para>Output: DataSet</para>
        ///</summary>
        public DataSet SelectAllDS()
        {
            IDbCommand cmd = this.CreateSelectAllCommand();
            return this.SelectDS(cmd);
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: CreateSelectAllFilterCommand</para>
        /// <para>Input: </para>
        /// <para>Output: IDbCommand</para>
        ///</summary>
        protected IDbCommand CreateSelectAllFilterCommand(string strFilter)
        {
            string strSQL = "SELECT  [New_ID],[Title],[MainContent],[Content],[NewIndex],[DatePost],[Status],[Display],[IsHomePage],[DateAproved],[DateExprired],[Category_ID],[User_ID],[Approved_ID],[SmallImageUrl],[LargeImageUrl] FROM [News]  WHERE " + RemoveInjection(strFilter);
            IDbCommand cmd = this.CreateCommand(strSQL);
            cmd.CommandType = CommandType.Text;
            return cmd;
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: CreateSelectAllByKeyFilterCommand</para>
        /// <para>Input: ColumnName,ColumnValue</para>
        /// <para>Output: IDbCommand</para>
        ///</summary>
        protected IDbCommand CreateSelectAllByKeyFilterCommand(string strFilter, string ColumnName, object Value)
        {
            string strSQL = "SELECT  [New_ID],[Title],[MainContent],[Content],[NewIndex],[DatePost],[Status],[Display],[IsHomePage],[DateAproved],[DateExprired],[Category_ID],[User_ID],[Approved_ID],[SmallImageUrl],[LargeImageUrl] FROM [News]  WHERE [News].[" + ColumnName + "]=@ColumnName AND " + RemoveInjection(strFilter);
            IDbCommand cmd = this.CreateCommand(strSQL);
            cmd.CommandType = CommandType.Text;
            this.CreateCommandParameter(cmd, "@ColumnName", Value);



            return cmd;
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: SelectAll</para>
        /// <para>Input: </para>
        /// <para>Output: List of NewsEntity</para>
        ///</summary>
        public List<NewsEntity> SelectAllFilter(string strFilter)
        {
            IDbCommand cmd = this.CreateSelectAllFilterCommand(strFilter);
            return this.SelectList(cmd);
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: SelectAllDSFilter</para>
        /// <para>Input: </para>
        /// <para>Output: DataSet</para>
        ///</summary>
        public DataSet SelectAllDSFilter(string strFilter)
        {
            IDbCommand cmd = this.CreateSelectAllFilterCommand(strFilter);
            return this.SelectDS(cmd);
        }
        #endregion

        #region Insert functions
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: CreateInsertCommand</para>
        /// <para>Input: NewsEntity</para>
        /// <para>Output: IDbCommand</para>
        ///</summary>
        protected IDbCommand CreateInsertCommand(NewsEntity o)
        {
            string strSQL = "INSERT INTO [News]([Title],[MainContent],[Content],[NewIndex],[DatePost],[Status],[Display],[IsHomePage],[DateAproved],[DateExprired],[Category_ID],[User_ID],[Approved_ID],[SmallImageUrl],[LargeImageUrl]) VALUES  (@Title,@MainContent,@Content,@NewIndex,@DatePost,@Status,@Display,@IsHomePage,@DateAproved,@DateExprired,@Category_ID,@User_ID,@Approved_ID,@SmallImageUrl,@LargeImageUrl);SELECT  @@IDENTITY";
            IDbCommand cmd = this.CreateCommand(strSQL);
            cmd.CommandType = CommandType.Text;
            if (o.IsNullTitle)
                this.CreateCommandParameter(cmd, "@Title", System.DBNull.Value);
            else
                this.CreateCommandParameter(cmd, "@Title", o.Title);

            if (o.IsNullMainContent)
                this.CreateCommandParameter(cmd, "@MainContent", System.DBNull.Value);
            else
                this.CreateCommandParameter(cmd, "@MainContent", o.MainContent);

            if (o.IsNullContent)
                this.CreateCommandParameter(cmd, "@Content", System.DBNull.Value);
            else
                this.CreateCommandParameter(cmd, "@Content", o.Content);

            if (o.IsNullNewIndex)
                this.CreateCommandParameter(cmd, "@NewIndex", System.DBNull.Value);
            else
                this.CreateCommandParameter(cmd, "@NewIndex", o.NewIndex);

            if (o.IsNullDatePost)
                this.CreateCommandParameter(cmd, "@DatePost", System.DBNull.Value);
            else
                this.CreateCommandParameter(cmd, "@DatePost", o.DatePost);

            if (o.IsNullStatus)
                this.CreateCommandParameter(cmd, "@Status", System.DBNull.Value);
            else
                this.CreateCommandParameter(cmd, "@Status", o.Status);

            if (o.IsNullDisplay)
                this.CreateCommandParameter(cmd, "@Display", System.DBNull.Value);
            else
                this.CreateCommandParameter(cmd, "@Display", o.Display);

            if (o.IsNullIsHomePage)
                this.CreateCommandParameter(cmd, "@IsHomePage", System.DBNull.Value);
            else
                this.CreateCommandParameter(cmd, "@IsHomePage", o.IsHomePage);

            if (o.IsNullDateAproved)
                this.CreateCommandParameter(cmd, "@DateAproved", System.DBNull.Value);
            else
                this.CreateCommandParameter(cmd, "@DateAproved", o.DateAproved);

            if (o.IsNullDateExprired)
                this.CreateCommandParameter(cmd, "@DateExprired", System.DBNull.Value);
            else
                this.CreateCommandParameter(cmd, "@DateExprired", o.DateExprired);

            if (o.IsNullCategory_ID)
                this.CreateCommandParameter(cmd, "@Category_ID", System.DBNull.Value);
            else
                this.CreateCommandParameter(cmd, "@Category_ID", o.Category_ID);

            if (o.IsNullUser_ID)
                this.CreateCommandParameter(cmd, "@User_ID", System.DBNull.Value);
            else
                this.CreateCommandParameter(cmd, "@User_ID", o.User_ID);

            if (o.IsNullApproved_ID)
                this.CreateCommandParameter(cmd, "@Approved_ID", System.DBNull.Value);
            else
                this.CreateCommandParameter(cmd, "@Approved_ID", o.Approved_ID);

            if (o.IsNullSmallImageUrl)
                this.CreateCommandParameter(cmd, "@SmallImageUrl", System.DBNull.Value);
            else
                this.CreateCommandParameter(cmd, "@SmallImageUrl", o.SmallImageUrl);

            if (o.IsNullLargeImageUrl)
                this.CreateCommandParameter(cmd, "@LargeImageUrl", System.DBNull.Value);
            else
                this.CreateCommandParameter(cmd, "@LargeImageUrl", o.LargeImageUrl);


            return cmd;
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: Save</para>
        /// <para>Input: NewsEntity</para>
        /// <para>Output: return true if succeeded else return false</para>
        ///</summary>
        public bool Save(NewsEntity o)
        {
            bool result = false;
            IDbCommand cmd = this.CreateInsertCommand(o);
            object id = this.ExecuteScalar(cmd, ref result);
            cmd.Dispose();
            try
            {
                o.New_ID = int.Parse(Convert.ToString(id));
            }
            catch { }
            return result;
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: SaveList</para>
        /// <para>Input: List of NewsEntity</para>
        /// <para>Output: </para>
        ///</summary>
        public void SaveList(List<NewsEntity> list)
        {
            foreach (NewsEntity o in list)
            {
                try
                {
                    this.Save(o);
                }
                catch
                {
                }
            }
        }
        #endregion

        #region Update functions
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: CreateUpdateCommand</para>
        /// <para>Input: NewsEntity</para>
        /// <para>Output: </para>
        ///</summary>
        protected IDbCommand CreateUpdateCommand(NewsEntity o)
        {
            string strSQL = "UPDATE  [News] SET [News].[Title]=@Title,[News].[MainContent]=@MainContent,[News].[Content]=@Content,[News].[NewIndex]=@NewIndex,[News].[DatePost]=@DatePost,[News].[Status]=@Status,[News].[Display]=@Display,[News].[IsHomePage]=@IsHomePage,[News].[DateAproved]=@DateAproved,[News].[DateExprired]=@DateExprired,[News].[Category_ID]=@Category_ID,[News].[User_ID]=@User_ID,[News].[Approved_ID]=@Approved_ID,[News].[SmallImageUrl]=@SmallImageUrl,[News].[LargeImageUrl]=@LargeImageUrl WHERE [News].[New_ID]=@New_ID";
            IDbCommand cmd = this.CreateCommand(strSQL);
            cmd.CommandType = CommandType.Text;
            if (o.IsNullNew_ID)
                this.CreateCommandParameter(cmd, "@New_ID", System.DBNull.Value);
            else
                this.CreateCommandParameter(cmd, "@New_ID", o.New_ID);

            if (o.IsNullTitle)
                this.CreateCommandParameter(cmd, "@Title", System.DBNull.Value);
            else
                this.CreateCommandParameter(cmd, "@Title", o.Title);

            if (o.IsNullMainContent)
                this.CreateCommandParameter(cmd, "@MainContent", System.DBNull.Value);
            else
                this.CreateCommandParameter(cmd, "@MainContent", o.MainContent);

            if (o.IsNullContent)
                this.CreateCommandParameter(cmd, "@Content", System.DBNull.Value);
            else
                this.CreateCommandParameter(cmd, "@Content", o.Content);

            if (o.IsNullNewIndex)
                this.CreateCommandParameter(cmd, "@NewIndex", System.DBNull.Value);
            else
                this.CreateCommandParameter(cmd, "@NewIndex", o.NewIndex);

            if (o.IsNullDatePost)
                this.CreateCommandParameter(cmd, "@DatePost", System.DBNull.Value);
            else
                this.CreateCommandParameter(cmd, "@DatePost", o.DatePost);

            if (o.IsNullStatus)
                this.CreateCommandParameter(cmd, "@Status", System.DBNull.Value);
            else
                this.CreateCommandParameter(cmd, "@Status", o.Status);

            if (o.IsNullDisplay)
                this.CreateCommandParameter(cmd, "@Display", System.DBNull.Value);
            else
                this.CreateCommandParameter(cmd, "@Display", o.Display);

            if (o.IsNullIsHomePage)
                this.CreateCommandParameter(cmd, "@IsHomePage", System.DBNull.Value);
            else
                this.CreateCommandParameter(cmd, "@IsHomePage", o.IsHomePage);

            if (o.IsNullDateAproved)
                this.CreateCommandParameter(cmd, "@DateAproved", System.DBNull.Value);
            else
                this.CreateCommandParameter(cmd, "@DateAproved", o.DateAproved);

            if (o.IsNullDateExprired)
                this.CreateCommandParameter(cmd, "@DateExprired", System.DBNull.Value);
            else
                this.CreateCommandParameter(cmd, "@DateExprired", o.DateExprired);

            if (o.IsNullCategory_ID)
                this.CreateCommandParameter(cmd, "@Category_ID", System.DBNull.Value);
            else
                this.CreateCommandParameter(cmd, "@Category_ID", o.Category_ID);

            if (o.IsNullUser_ID)
                this.CreateCommandParameter(cmd, "@User_ID", System.DBNull.Value);
            else
                this.CreateCommandParameter(cmd, "@User_ID", o.User_ID);

            if (o.IsNullApproved_ID)
                this.CreateCommandParameter(cmd, "@Approved_ID", System.DBNull.Value);
            else
                this.CreateCommandParameter(cmd, "@Approved_ID", o.Approved_ID);

            if (o.IsNullSmallImageUrl)
                this.CreateCommandParameter(cmd, "@SmallImageUrl", System.DBNull.Value);
            else
                this.CreateCommandParameter(cmd, "@SmallImageUrl", o.SmallImageUrl);

            if (o.IsNullLargeImageUrl)
                this.CreateCommandParameter(cmd, "@LargeImageUrl", System.DBNull.Value);
            else
                this.CreateCommandParameter(cmd, "@LargeImageUrl", o.LargeImageUrl);


            return cmd;
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: CreateUpdateFieldCommand</para>
        /// <para>Input: ColumnName,ColumnValue,New_ID</para>
        /// <para>Output: IDbCommand</para>
        ///</summary>
        protected IDbCommand CreateUpdateFieldCommand(string ColumnName, object Value, int New_ID)
        {
            string strSQL = "UPDATE  [News] SET [News].[" + ColumnName + "]=@ColumnName WHERE [News].[New_ID]=@New_ID";
            IDbCommand cmd = this.CreateCommand(strSQL);
            cmd.CommandType = CommandType.Text;
            this.CreateCommandParameter(cmd, "@New_ID", New_ID);



            this.CreateCommandParameter(cmd, "@ColumnName", Value);


            return cmd;
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: Update</para>
        /// <para>Input: NewsEntity</para>
        /// <para>Output: return true if succeeded else return false</para>
        ///</summary>
        public bool Update(NewsEntity o)
        {
            IDbCommand cmd = this.CreateUpdateCommand(o);
            bool result = this.ExcuteNoneQuery(cmd);
            cmd.Dispose();
            return result;
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: UpdateList</para>
        /// <para>Input: List of NewsEntity</para>
        /// <para>Output: </para>
        ///</summary>
        public void UpdateList(List<NewsEntity> list)
        {
            foreach (NewsEntity o in list)
            {
                try
                {
                    this.Update(o);
                }
                catch
                {
                }
            }
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: UpdateTitle</para>
        /// <para>Input: NewTitle,New_ID</para>
        /// <para>Output: return true if succeeded else return false</para>
        ///</summary>
        public bool UpdateTitle(string NewTitle, int New_ID)
        {
            IDbCommand cmd = this.CreateUpdateFieldCommand("Title", NewTitle, New_ID);
            bool result = this.ExcuteNoneQuery(cmd);
            cmd.Dispose();
            return result;
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: UpdateMainContent</para>
        /// <para>Input: NewMainContent,New_ID</para>
        /// <para>Output: return true if succeeded else return false</para>
        ///</summary>
        public bool UpdateMainContent(string NewMainContent, int New_ID)
        {
            IDbCommand cmd = this.CreateUpdateFieldCommand("MainContent", NewMainContent, New_ID);
            bool result = this.ExcuteNoneQuery(cmd);
            cmd.Dispose();
            return result;
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: UpdateContent</para>
        /// <para>Input: NewContent,New_ID</para>
        /// <para>Output: return true if succeeded else return false</para>
        ///</summary>
        public bool UpdateContent(string NewContent, int New_ID)
        {
            IDbCommand cmd = this.CreateUpdateFieldCommand("Content", NewContent, New_ID);
            bool result = this.ExcuteNoneQuery(cmd);
            cmd.Dispose();
            return result;
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: UpdateNewIndex</para>
        /// <para>Input: NewNewIndex,New_ID</para>
        /// <para>Output: return true if succeeded else return false</para>
        ///</summary>
        public bool UpdateNewIndex(int NewNewIndex, int New_ID)
        {
            IDbCommand cmd = this.CreateUpdateFieldCommand("NewIndex", NewNewIndex, New_ID);
            bool result = this.ExcuteNoneQuery(cmd);
            cmd.Dispose();
            return result;
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: UpdateDatePost</para>
        /// <para>Input: NewDatePost,New_ID</para>
        /// <para>Output: return true if succeeded else return false</para>
        ///</summary>
        public bool UpdateDatePost(DateTime NewDatePost, int New_ID)
        {
            IDbCommand cmd = this.CreateUpdateFieldCommand("DatePost", NewDatePost, New_ID);
            bool result = this.ExcuteNoneQuery(cmd);
            cmd.Dispose();
            return result;
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: UpdateStatus</para>
        /// <para>Input: NewStatus,New_ID</para>
        /// <para>Output: return true if succeeded else return false</para>
        ///</summary>
        public bool UpdateStatus(Byte NewStatus, int New_ID)
        {
            IDbCommand cmd = this.CreateUpdateFieldCommand("Status", NewStatus, New_ID);
            bool result = this.ExcuteNoneQuery(cmd);
            cmd.Dispose();
            return result;
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: UpdateDisplay</para>
        /// <para>Input: NewDisplay,New_ID</para>
        /// <para>Output: return true if succeeded else return false</para>
        ///</summary>
        public bool UpdateDisplay(bool NewDisplay, int New_ID)
        {
            IDbCommand cmd = this.CreateUpdateFieldCommand("Display", NewDisplay, New_ID);
            bool result = this.ExcuteNoneQuery(cmd);
            cmd.Dispose();
            return result;
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: UpdateIsHomePage</para>
        /// <para>Input: NewIsHomePage,New_ID</para>
        /// <para>Output: return true if succeeded else return false</para>
        ///</summary>
        public bool UpdateIsHomePage(bool NewIsHomePage, int New_ID)
        {
            IDbCommand cmd = this.CreateUpdateFieldCommand("IsHomePage", NewIsHomePage, New_ID);
            bool result = this.ExcuteNoneQuery(cmd);
            cmd.Dispose();
            return result;
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: UpdateDateAproved</para>
        /// <para>Input: NewDateAproved,New_ID</para>
        /// <para>Output: return true if succeeded else return false</para>
        ///</summary>
        public bool UpdateDateAproved(DateTime NewDateAproved, int New_ID)
        {
            IDbCommand cmd = this.CreateUpdateFieldCommand("DateAproved", NewDateAproved, New_ID);
            bool result = this.ExcuteNoneQuery(cmd);
            cmd.Dispose();
            return result;
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: UpdateDateExprired</para>
        /// <para>Input: NewDateExprired,New_ID</para>
        /// <para>Output: return true if succeeded else return false</para>
        ///</summary>
        public bool UpdateDateExprired(DateTime NewDateExprired, int New_ID)
        {
            IDbCommand cmd = this.CreateUpdateFieldCommand("DateExprired", NewDateExprired, New_ID);
            bool result = this.ExcuteNoneQuery(cmd);
            cmd.Dispose();
            return result;
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: UpdateCategory_ID</para>
        /// <para>Input: NewCategory_ID,New_ID</para>
        /// <para>Output: return true if succeeded else return false</para>
        ///</summary>
        public bool UpdateCategory_ID(int NewCategory_ID, int New_ID)
        {
            IDbCommand cmd = this.CreateUpdateFieldCommand("Category_ID", NewCategory_ID, New_ID);
            bool result = this.ExcuteNoneQuery(cmd);
            cmd.Dispose();
            return result;
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: UpdateUser_ID</para>
        /// <para>Input: NewUser_ID,New_ID</para>
        /// <para>Output: return true if succeeded else return false</para>
        ///</summary>
        public bool UpdateUser_ID(int NewUser_ID, int New_ID)
        {
            IDbCommand cmd = this.CreateUpdateFieldCommand("User_ID", NewUser_ID, New_ID);
            bool result = this.ExcuteNoneQuery(cmd);
            cmd.Dispose();
            return result;
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: UpdateApproved_ID</para>
        /// <para>Input: NewApproved_ID,New_ID</para>
        /// <para>Output: return true if succeeded else return false</para>
        ///</summary>
        public bool UpdateApproved_ID(int NewApproved_ID, int New_ID)
        {
            IDbCommand cmd = this.CreateUpdateFieldCommand("Approved_ID", NewApproved_ID, New_ID);
            bool result = this.ExcuteNoneQuery(cmd);
            cmd.Dispose();
            return result;
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: UpdateSmallImageUrl</para>
        /// <para>Input: NewSmallImageUrl,New_ID</para>
        /// <para>Output: return true if succeeded else return false</para>
        ///</summary>
        public bool UpdateSmallImageUrl(string NewSmallImageUrl, int New_ID)
        {
            IDbCommand cmd = this.CreateUpdateFieldCommand("SmallImageUrl", NewSmallImageUrl, New_ID);
            bool result = this.ExcuteNoneQuery(cmd);
            cmd.Dispose();
            return result;
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: UpdateLargeImageUrl</para>
        /// <para>Input: NewLargeImageUrl,New_ID</para>
        /// <para>Output: return true if succeeded else return false</para>
        ///</summary>
        public bool UpdateLargeImageUrl(string NewLargeImageUrl, int New_ID)
        {
            IDbCommand cmd = this.CreateUpdateFieldCommand("LargeImageUrl", NewLargeImageUrl, New_ID);
            bool result = this.ExcuteNoneQuery(cmd);
            cmd.Dispose();
            return result;
        }
        #endregion

        #region Delete functions
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: DeleteAllCommand</para>
        /// <para>Input: </para>
        /// <para>Output: IDbCommand</para>
        ///</summary>
        protected IDbCommand CreateDeleteAllCommand()
        {
            string strSQL = "DELETE   FROM [News]  ";
            IDbCommand cmd = this.CreateCommand(strSQL);
            cmd.CommandType = CommandType.Text;
            return cmd;
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: DeleteCommand</para>
        /// <para>Input: NewsEntity</para>
        /// <para>Output: IDbCommand</para>
        ///</summary>
        protected IDbCommand CreateDeleteCommand(NewsEntity o)
        {
            string strSQL = "DELETE   FROM [News]   WHERE [News].[New_ID]=@New_ID";
            IDbCommand cmd = this.CreateCommand(strSQL);
            cmd.CommandType = CommandType.Text;
            if (o.IsNullNew_ID)
                this.CreateCommandParameter(cmd, "@New_ID", System.DBNull.Value);
            else
                this.CreateCommandParameter(cmd, "@New_ID", o.New_ID);


            return cmd;
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: DeleteAll</para>
        /// <para>Input: </para>
        /// <para>Output: return true if succeeded else return false</para>
        ///</summary>
        public bool DeleteAll()
        {
            IDbCommand cmd = this.CreateDeleteAllCommand();
            bool result = this.ExcuteNoneQuery(cmd);
            cmd.Dispose();
            return result;
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: CreateDeleteByPrimaryKeyCommand</para>
        /// <para>Input: New_ID</para>
        /// <para>Output: IDbCommand</para>
        ///</summary>
        protected IDbCommand CreateDeleteByPrimaryKeyCommand(int New_ID)
        {
            string strSQL = "DELETE   FROM [News]   WHERE [News].[New_ID]=@New_ID";
            IDbCommand cmd = this.CreateCommand(strSQL);
            cmd.CommandType = CommandType.Text;
            this.CreateCommandParameter(cmd, "@New_ID", New_ID);



            return cmd;
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: CreateDeleteByKeyCommand</para>
        /// <para>Input: ColumnName , ColumnValue</para>
        /// <para>Output: IDbCommand</para>
        ///</summary>
        protected IDbCommand CreateDeleteByKeyCommand(string ColumnName, object Value)
        {
            string strSQL = "DELETE   FROM [News]   WHERE [News].[" + ColumnName + "]=@ColumnName";
            IDbCommand cmd = this.CreateCommand(strSQL);
            cmd.CommandType = CommandType.Text;
            this.CreateCommandParameter(cmd, "@ColumnName", Value);



            return cmd;
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: Delete</para>
        /// <para>Input: NewsEntity</para>
        /// <para>Output: return true if succeeded else return false</para>
        ///</summary>
        public bool Delete(NewsEntity o)
        {
            IDbCommand cmd = this.CreateDeleteCommand(o);
            bool result = this.ExcuteNoneQuery(cmd);
            cmd.Dispose();
            return result;
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: DeleteByID</para>
        /// <para>Input: New_ID</para>
        /// <para>Output: return true if succeeded else return false</para>
        ///</summary>
        public bool DeleteByID(int New_ID)
        {
            IDbCommand cmd = this.CreateDeleteByPrimaryKeyCommand(New_ID);
            bool result = this.ExcuteNoneQuery(cmd);
            cmd.Dispose();
            return result;
        }
        #endregion

        #region Select join to CategoriesUsers functions
        #endregion

        #region Select join to Categories functions
        #endregion

        #region Select join to Users functions
        #endregion

        #region Select,delete by New_ID functions
        #endregion

        #region Select,delete by Category_ID functions
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: SelectAllByCategory_ID</para>
        /// <para>Input: Category_ID</para>
        /// <para>Output: List of NewsEntity</para>
        ///</summary>
        public List<NewsEntity> SelectAllByCategory_ID(int Category_ID)
        {
            IDbCommand cmd = this.CreateSelectAllByKeyCommand("Category_ID", Category_ID);
            return this.SelectList(cmd);
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: SelectAllByCategory_ID</para>
        /// <para>Input: Category_ID</para>
        /// <para>Output: DataSet</para>
        ///</summary>
        public DataSet SelectAllDSByCategory_ID(int Category_ID)
        {
            IDbCommand cmd = this.CreateSelectAllByKeyCommand("Category_ID", Category_ID);
            return this.SelectDS(cmd);
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: SelectAllByCategory_ID</para>
        /// <para>Input: Category_ID</para>
        /// <para>Output: List of NewsEntity</para>
        ///</summary>
        public List<NewsEntity> SelectAllByCategory_IDFilter(string strFilter, int Category_ID)
        {
            IDbCommand cmd = this.CreateSelectAllByKeyFilterCommand(strFilter, "Category_ID", Category_ID);
            return this.SelectList(cmd);
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: SelectAllByCategory_ID</para>
        /// <para>Input: Category_ID</para>
        /// <para>Output: DataSet</para>
        ///</summary>
        public DataSet SelectAllDSByCategory_IDFilter(string strFilter, int Category_ID)
        {
            IDbCommand cmd = this.CreateSelectAllByKeyFilterCommand(strFilter, "Category_ID", Category_ID);
            return this.SelectDS(cmd);
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: DeleteByCategory_ID</para>
        /// <para>Input: Category_ID</para>
        /// <para>Output: return true if succeeded else return false</para>
        ///</summary>
        public bool DeleteByCategory_ID(int Category_ID)
        {
            IDbCommand cmd = this.CreateDeleteByKeyCommand("Category_ID", Category_ID);
            bool result = this.ExcuteNoneQuery(cmd);
            cmd.Dispose();
            return result;
        }
        #endregion

        #region Select,delete by User_ID functions
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: SelectAllByUser_ID</para>
        /// <para>Input: User_ID</para>
        /// <para>Output: List of NewsEntity</para>
        ///</summary>
        public List<NewsEntity> SelectAllByUser_ID(int User_ID)
        {
            IDbCommand cmd = this.CreateSelectAllByKeyCommand("User_ID", User_ID);
            return this.SelectList(cmd);
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: SelectAllByUser_ID</para>
        /// <para>Input: User_ID</para>
        /// <para>Output: DataSet</para>
        ///</summary>
        public DataSet SelectAllDSByUser_ID(int User_ID)
        {
            IDbCommand cmd = this.CreateSelectAllByKeyCommand("User_ID", User_ID);
            return this.SelectDS(cmd);
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: SelectAllByUser_ID</para>
        /// <para>Input: User_ID</para>
        /// <para>Output: List of NewsEntity</para>
        ///</summary>
        public List<NewsEntity> SelectAllByUser_IDFilter(string strFilter, int User_ID)
        {
            IDbCommand cmd = this.CreateSelectAllByKeyFilterCommand(strFilter, "User_ID", User_ID);
            return this.SelectList(cmd);
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: SelectAllByUser_ID</para>
        /// <para>Input: User_ID</para>
        /// <para>Output: DataSet</para>
        ///</summary>
        public DataSet SelectAllDSByUser_IDFilter(string strFilter, int User_ID)
        {
            IDbCommand cmd = this.CreateSelectAllByKeyFilterCommand(strFilter, "User_ID", User_ID);
            return this.SelectDS(cmd);
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: DeleteByUser_ID</para>
        /// <para>Input: User_ID</para>
        /// <para>Output: return true if succeeded else return false</para>
        ///</summary>
        public bool DeleteByUser_ID(int User_ID)
        {
            IDbCommand cmd = this.CreateDeleteByKeyCommand("User_ID", User_ID);
            bool result = this.ExcuteNoneQuery(cmd);
            cmd.Dispose();
            return result;
        }
        #endregion

        #region Select,Delete by Category_IDUser_ID
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: CreateSelectByCategory_IDUser_IDCommand</para>
        /// <para>Input: Category_ID,User_ID</para>
        /// <para>Output: IDbCommand</para>
        ///</summary>
        protected IDbCommand CreateSelectAllByCategory_IDUser_IDCommand(int Category_ID, int User_ID)
        {
            string strSQL = "SELECT  [New_ID],[Title],[MainContent],[Content],[NewIndex],[DatePost],[Status],[Display],[IsHomePage],[DateAproved],[DateExprired],[Category_ID],[User_ID],[Approved_ID],[SmallImageUrl],[LargeImageUrl] FROM [News]  WHERE [News].[Category_ID]=@Category_ID AND [News].[User_ID]=@User_ID";
            IDbCommand cmd = this.CreateCommand(strSQL);
            cmd.CommandType = CommandType.Text;
            this.CreateCommandParameter(cmd, "@Category_ID", Category_ID);


            this.CreateCommandParameter(cmd, "@User_ID", User_ID);



            return cmd;
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: SelectAllByCategory_IDUser_ID</para>
        /// <para>Input: Category_ID,User_ID</para>
        /// <para>Output: List of NewsEntity</para>
        ///</summary>
        public List<NewsEntity> SelectAllByCategory_IDUser_ID(int Category_ID, int User_ID)
        {
            IDbCommand cmd = this.CreateSelectAllByCategory_IDUser_IDCommand(Category_ID, User_ID);
            return this.SelectList(cmd);
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: SelectAllByCategory_IDUser_ID</para>
        /// <para>Input: Category_ID,User_ID</para>
        /// <para>Output: DataSet</para>
        ///</summary>
        public DataSet SelectAllDSByCategory_IDUser_ID(int Category_ID, int User_ID)
        {
            IDbCommand cmd = this.CreateSelectAllByCategory_IDUser_IDCommand(Category_ID, User_ID);
            return this.SelectDS(cmd);
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: CreateSelectByCategory_IDUser_IDFilterCommand</para>
        /// <para>Input: Category_ID,User_ID</para>
        /// <para>Output: IDbCommand</para>
        ///</summary>
        protected IDbCommand CreateSelectAllByCategory_IDUser_IDFilterCommand(string strFilter, int Category_ID, int User_ID)
        {
            string strSQL = "SELECT  [New_ID],[Title],[MainContent],[Content],[NewIndex],[DatePost],[Status],[Display],[IsHomePage],[DateAproved],[DateExprired],[Category_ID],[User_ID],[Approved_ID],[SmallImageUrl],[LargeImageUrl] FROM [News]  WHERE [News].[Category_ID]=@Category_ID AND [News].[User_ID]=@User_ID AND " + RemoveInjection(strFilter);
            IDbCommand cmd = this.CreateCommand(strSQL);
            cmd.CommandType = CommandType.Text;
            this.CreateCommandParameter(cmd, "@Category_ID", Category_ID);


            this.CreateCommandParameter(cmd, "@User_ID", User_ID);



            return cmd;
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: SelectAllByCategory_IDUser_ID</para>
        /// <para>Input: Category_ID,User_ID</para>
        /// <para>Output: List of NewsEntity</para>
        ///</summary>
        public List<NewsEntity> SelectAllByCategory_IDUser_IDFilter(string strFilter, int Category_ID, int User_ID)
        {
            IDbCommand cmd = this.CreateSelectAllByCategory_IDUser_IDFilterCommand(strFilter, Category_ID, User_ID);
            return this.SelectList(cmd);
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: SelectAllByCategory_IDUser_ID</para>
        /// <para>Input: Category_ID,User_ID</para>
        /// <para>Output: DataSet</para>
        ///</summary>
        public DataSet SelectAllDSByCategory_IDUser_IDFilter(string strFilter, int Category_ID, int User_ID)
        {
            IDbCommand cmd = this.CreateSelectAllByCategory_IDUser_IDFilterCommand(strFilter, Category_ID, User_ID);
            return this.SelectDS(cmd);
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: CreateDeleteByCategory_IDUser_IDCommand</para>
        /// <para>Input: Category_ID,User_ID</para>
        /// <para>Output: IDbCommand</para>
        ///</summary>
        protected IDbCommand CreateDeleteByCategory_IDUser_IDCommand(int Category_ID, int User_ID)
        {
            string strSQL = "DELETE   FROM [News]   WHERE [News].[Category_ID]=@Category_ID AND [News].[User_ID]=@User_ID";
            IDbCommand cmd = this.CreateCommand(strSQL);
            cmd.CommandType = CommandType.Text;
            this.CreateCommandParameter(cmd, "@Category_ID", Category_ID);


            this.CreateCommandParameter(cmd, "@User_ID", User_ID);



            return cmd;
        }
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: DeleteByCategory_IDUser_ID</para>
        /// <para>Input: Category_ID,User_ID</para>
        /// <para>Output: return true if succeeded else return false</para>
        ///</summary>
        public bool DeleteByCategory_IDUser_ID(int Category_ID, int User_ID)
        {
            IDbCommand cmd = this.CreateDeleteByCategory_IDUser_IDCommand(Category_ID, User_ID);
            bool result = false;
            result = this.ExcuteNoneQuery(cmd);
            cmd.Dispose();
            return result;
        }
        #endregion

        #region MapObject functions
        ///<summary>
        /// <para>Author: Auto generated by CSharp Code Generator v2.0</para>
        /// <para>Date:01/10/2010 33:09:48</para>
        /// <para>Name: MapObject</para>
        /// <para>Input: IDataReader</para>
        /// <para>Output: NewsEntity</para>
        ///</summary>
        protected override NewsEntity MapObject(IDataReader r)
        {
            NewsEntity entity = new NewsEntity();
            try
            {
                if (r.FieldCount > 0)
                {
                    try
                    {
                        int ordinal = r.GetOrdinal("New_ID");
                        if (!r.IsDBNull(ordinal)) entity.New_ID = ((int)(r.GetValue(ordinal)));
                    }
                    catch { }
                    try
                    {
                        int ordinal = r.GetOrdinal("Title");
                        if (!r.IsDBNull(ordinal)) entity.Title = ((string)(r.GetValue(ordinal)));
                    }
                    catch { }
                    try
                    {
                        int ordinal = r.GetOrdinal("MainContent");
                        if (!r.IsDBNull(ordinal)) entity.MainContent = ((string)(r.GetValue(ordinal)));
                    }
                    catch { }
                    try
                    {
                        int ordinal = r.GetOrdinal("Content");
                        if (!r.IsDBNull(ordinal)) entity.Content = ((string)(r.GetValue(ordinal)));
                    }
                    catch { }
                    try
                    {
                        int ordinal = r.GetOrdinal("NewIndex");
                        if (!r.IsDBNull(ordinal)) entity.NewIndex = ((int)(r.GetValue(ordinal)));
                    }
                    catch { }
                    try
                    {
                        int ordinal = r.GetOrdinal("DatePost");
                        if (!r.IsDBNull(ordinal)) entity.DatePost = ((DateTime)(r.GetValue(ordinal)));
                    }
                    catch { }
                    try
                    {
                        int ordinal = r.GetOrdinal("Status");
                        if (!r.IsDBNull(ordinal)) entity.Status = ((Byte)(r.GetValue(ordinal)));
                    }
                    catch { }
                    try
                    {
                        int ordinal = r.GetOrdinal("Display");
                        if (!r.IsDBNull(ordinal)) entity.Display = ((bool)(r.GetValue(ordinal)));
                    }
                    catch { }
                    try
                    {
                        int ordinal = r.GetOrdinal("IsHomePage");
                        if (!r.IsDBNull(ordinal)) entity.IsHomePage = ((bool)(r.GetValue(ordinal)));
                    }
                    catch { }
                    try
                    {
                        int ordinal = r.GetOrdinal("DateAproved");
                        if (!r.IsDBNull(ordinal)) entity.DateAproved = ((DateTime)(r.GetValue(ordinal)));
                    }
                    catch { }
                    try
                    {
                        int ordinal = r.GetOrdinal("DateExprired");
                        if (!r.IsDBNull(ordinal)) entity.DateExprired = ((DateTime)(r.GetValue(ordinal)));
                    }
                    catch { }
                    try
                    {
                        int ordinal = r.GetOrdinal("Category_ID");
                        if (!r.IsDBNull(ordinal)) entity.Category_ID = ((int)(r.GetValue(ordinal)));
                    }
                    catch { }
                    try
                    {
                        int ordinal = r.GetOrdinal("User_ID");
                        if (!r.IsDBNull(ordinal)) entity.User_ID = ((int)(r.GetValue(ordinal)));
                    }
                    catch { }
                    try
                    {
                        int ordinal = r.GetOrdinal("Approved_ID");
                        if (!r.IsDBNull(ordinal)) entity.Approved_ID = ((int)(r.GetValue(ordinal)));
                    }
                    catch { }
                    try
                    {
                        int ordinal = r.GetOrdinal("SmallImageUrl");
                        if (!r.IsDBNull(ordinal)) entity.SmallImageUrl = ((string)(r.GetValue(ordinal)));
                    }
                    catch { }
                    try
                    {
                        int ordinal = r.GetOrdinal("LargeImageUrl");
                        if (!r.IsDBNull(ordinal)) entity.LargeImageUrl = ((string)(r.GetValue(ordinal)));
                    }
                    catch { }
                    return entity;
                }
            }
            catch { }
            return null;
        }
        #endregion
    }
    /*****************************************************************************************************/
    /**********************************END NewsDAOBase*****************************************/
    /*****************************************************************************************************/
}

